package com.wlz.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wlz.demo.controller.dto.UserDTO;
import com.wlz.demo.entity.User;
import com.wlz.demo.mapper.UserMapper;
import com.wlz.demo.service.IUserService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IUserServiceImpl extends ServiceImpl<UserMapper, User>  implements IUserService {
    @Override
    public boolean login(UserDTO userDTO) {
        LambdaQueryWrapper<User> lqw = new LambdaQueryWrapper<>();
        lqw.eq(User::getUsername,userDTO.getUsername());
        lqw.eq(User::getPassword,userDTO.getPassword());
        List<User> list = list(lqw);
        return list.size() != 0;

    }

}
